<?php
	$css_list[0]['url'] = './tpl/css/article.css';
	$js_list[0] = './public/js/jquery.masonry.js';
    $js_list[1] = './public/js/city.js';
    
    if(empty($_FANWE['cache']['medals'])) {
        Cache::getInstance()->loadCache('medals');
    }
?>
<!--{template inc/header_w}-->
<style>
.items  li {float:left;}
</style>
<div class="main_body">
    <div class="cata cata1">
        {if !empty($tag_list)}
        <div class="i_tags">
            <h3><a href="javascript:;" class="current" onclick="showtags(0,this)" ><em class="ui"></em><b>全部</b></a></h3>
            <ul>
            <!--{loop $tag_list $tag}-->
                <li><a href="javascript:;" onclick="showtags({$tag['tag_id']},this)" class="c">{$tag['tag_name']}</a></li>
            <!--{/loop}-->
            </ul>
            <span class="tag-arrow"></span>
        </div>
        {/if}
        <div class="i_catas{if empty($tag_list)} i_catas2{/if}">
            <span class="j_prev ui" onclick="javascript:cata_slide(1, {$cate_id});"></span>
            <span class="j_next ui" onclick="javascript:cata_slide(-1, {$cate_id});"></span>
            <div class="j_list">
                <div id="cataSlide">
                    <ul id="tags">
                        <!--{loop $cates $item}-->
                        <li name="tag_{$item['tag_id']}"><a href="{if $item['cate_type'] == 0}{u article/index cate=$item['cate_id']}&anli={$item['anli']}{elseif $item['cate_type'] == 1}{u product/list cate=$item['cate_id']}{elseif $item['cate_type'] == 2}{u book/cate cate=$item['cate_code']}{elseif $item['cate_type'] == 3}{u shopinfo/index cate=$item['cate_id']}{/if}"{if $_GET['cate']==$item['cate_id']} class="current"{/if}>{$item['cate_name']}{if $item['hot'] == 1}<img src="/public/v1/img/hot.gif" class="hot"/>{/if}<img src="/public/v1/img/cata_icon{$item['cate_type']}{if ($item['cate_type'] == 3 && $item['is_personal'] == 1) || ($item['cate_type'] == 0 && $item['anli'] == 1)}_p{/if}.gif" /></a></li>
                        <!--{/loop}-->
                    </ul>
                </div>
                <p id="currpage" style="float:right;font-size:14px;"></p>
            </div>
        </div>
    </div>
<script>
$(document).ready(function(){
    var unit_height=$('#cataSlide').height();
    var max_height=$('#cataSlide ul').height();
    window.pages = Math.ceil(max_height/unit_height);
    window.page = parseInt($.cookie('cate_{$cate_id}')) || 1;
    if($('#cataSlide ul .current').offset()) {
        var ds_height=$('#cataSlide ul .current').offset().top-$('#cataSlide ul').offset().top;
        window.page = Math.ceil(ds_height/unit_height);
        
        var top = (-window.page+1)*unit_height;
        $('#cataSlide ul').css('top',top+'px');
    } else if(window.page > 1) {
        var top = (-window.page+1)*unit_height;
        $('#cataSlide ul').css('top',top+'px');
    }
    $('#currpage').html(window.page+'/'+window.pages);
});
</script>
    <div class="wf_filter">
        <a href="/shopinfo.php?action=index&cate={$cate_id}{if $orderkey!='sharenum'}&order=sharenum{/if}{if isset($_GET['vshop'])}&vshop{/if}{if $areaname!=''}{if $cityidstr}&cityid={$cityidstr}{elseif $provinceid}&provinceid={$provinceid}{/if}&areaname=$areaname{/if}" class="a1{if $orderkey=='sharenum'} current{/if}" title="按分享数从高到低">{if $orderkey=='sharenum'}分享数从高到低{else}分享数{/if}</a>
        <a href="/shopinfo.php?action=index&cate={$cate_id}{if $orderkey!='commentnum'}&order=commentnum{/if}{if isset($_GET['vshop'])}&vshop{/if}{if $areaname!=''}{if $cityidstr}&cityid={$cityidstr}{elseif $provinceid}&provinceid={$provinceid}{/if}&areaname=$areaname{/if}" class="a1{if $orderkey=='commentnum'} current{/if}" title="按评论数从高到低">{if $orderkey=='commentnum'}评论数从高到低{else}评论数{/if}</a>
        <a href="/shopinfo.php?action=index&cate={$cate_id}{if $orderkey!='bzj'}&order=bzj{/if}{if isset($_GET['vshop'])}&vshop{/if}{if $areaname!=''}{if $cityidstr}&cityid={$cityidstr}{elseif $provinceid}&provinceid={$provinceid}{/if}&areaname=$areaname{/if}" class="a1{if $orderkey=='bzj'} current{/if}" title="按保证金从高到低">{if $orderkey=='bzj'}保证金从高到低{else}保证金{/if}</a>
        {if $r['show_area'] == 0}
        <a id="areatigger" href="#" class="a1">{if !empty($areaname)}{$areaname}{else}地区{/if}</a>
        <div id="area" class="wf_filter_area">
            <p>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=113&areaname=合肥">合肥</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=133&areaname=福州">福州</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=147&areaname=兰州">兰州</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=161&areaname=广州">广州</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=188&areaname=南宁">南宁</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=199&areaname=贵阳">贵阳</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=209&areaname=海口">海口</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=216&areaname=石家庄">石家庄</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=231&areaname=哈尔滨">哈尔滨</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=245&areaname=郑州">郑州</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=264&areaname=香港">香港</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=267&areaname=武汉">武汉</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=284&areaname=长沙">长沙</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=298&areaname=南京">南京</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=324&areaname=南昌">南昌</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=337&areaname=长春">长春</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=348&areaname=沈阳">沈阳</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=363&areaname=呼和浩特">呼和浩特</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=375&areaname=银川">银川</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=379&areaname=西宁">西宁</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=388&areaname=济南">济南</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=421&areaname=西安">西安</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=432&areaname=成都">成都</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=496&areaname=乌鲁木齐">乌鲁木齐</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=514&areaname=拉萨">拉萨</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=521&areaname=昆明">昆明</a> <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}&cityid=540&areaname=杭州">杭州</a>
            </p>
            <p>

                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=1&areaname=北京">北京</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=2&areaname=上海">上海</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=3&areaname=重庆">重庆</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=4&areaname=安徽">安徽</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=5&areaname=福建">福建</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=6&areaname=甘肃">甘肃</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=7&areaname=广东">广东</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=8&areaname=广西">广西</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=9&areaname=贵州">贵州</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=10&areaname=海南">海南</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=11&areaname=河北">河北</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=12&areaname=黑龙江">黑龙江</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=13&areaname=河南">河南</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=14&areaname=香港">香港</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=15&areaname=湖北">湖北</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=16&areaname=湖南">湖南</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=17&areaname=江苏">江苏</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=18&areaname=江西">江西</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=19&areaname=吉林">吉林</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=20&areaname=辽宁">辽宁</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=21&areaname=澳门">澳门</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=22&areaname=内蒙古">内蒙古</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=23&areaname=宁夏">宁夏</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=24&areaname=青海">青海</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=25&areaname=山东">山东</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=26&areaname=山西">山西</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=27&areaname=陕西">陕西</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=28&areaname=四川">四川</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=29&areaname=台湾">台湾</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=30&areaname=天津">天津</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=31&areaname=新疆">新疆</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=32&areaname=西藏">西藏</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=33&areaname=云南">云南</a>
                <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&provinceid=34&areaname=浙江">浙江</a>
            </p>
            <div>
				<select id="province" name="province" class="g_ipt1">
				</select>
				&nbsp;&nbsp;
				<select id="city" name="city" class="g_ipt1">
				</select>
				<input type="button" onclick="addcity()" value="添加" class="g_btn2">
				<input type="button" onclick="docitysea()" value="确定" class="g_btn2">
                <input type="button" onclick="closearea()" value="× 关闭" class="g_btn2">
           </div>
           <p id="cities" class="i_cities">
                {if !empty($cityidarr)}
                {loop $cityidarr $k $id}
                <a id="city_{$id}" href="javascript:rmcity({$id});">{$areanamearr[$k]}<span>×</span></a>
                {/loop}
                {/if}
           </p>
        </div>
        {/if}
        {if $r['show_vshop'] == 1}
        <a href="/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if !isset($_GET['vshop'])}&vshop{/if}{if $areaname!=''}{if $cityidstr}&cityid={$cityidstr}{elseif $provinceid}&provinceid={$provinceid}{/if}&areaname=$areaname{/if}" class="a1{if isset($_GET['vshop'])} current{/if}" title="仅显示V商家">V商家</a>
        {/if}
        <span style="line-height:40px;padding-left:10px;">共计<span style="font-weight:bold;font-size:16px;">{$count}</span>个商家资料</span>
    </div>
    
    {if !empty($keywordsshow)}
    <div class="wf_filter_cat">
        <!--{loop $keywordsshow $v}-->
        <label><input type="checkbox" name="ids" class="j_check" onclick="gotourl()" value="{$v['id']}"{if $v['checked']} checked{/if}>{$v['keyword']}</label>
        <!--{/loop}-->
    </div>
    {/if}

    <div class="wf_list" id="wfContainer">
        {if !empty($shop_list)}
        <!--{loop $shop_list $item}-->
        <div class="item">
            <a href="{u shopinfo/show id=$item['id']}" target="_blank" class="a1"><img src="{$item[img]}" class="wf_img" width="{$item[width]}" height="{$item[height]}" /></a>
            <div class="i_info">
                <a style="display:inline-block;padding:2px 2px;" href="{u shopinfo/show id=$item['id']}">{$item[name]}
                {if $item['uid']}&nbsp;
                <!--{if $item['v2'] > 0}-->
                <?php $medal = $_FANWE['cache']['medals']['all'][$item['v2']]; ?>
                    <img src="{$medal['small_img']}" height="25" alt="{$medal['desc']}" title="{$medal['desc']}">
                <!--{/if}--> 
                {elseif $item['show_v2'] > 0}
                    <img src="/public/medal/small/v{$item['show_v2']}.jpg" height="25" alt="{$medal['desc']}" title="{$medal['desc']}">
                {/if}</a>
            </div>
            <div class="i_time">
                店铺：<a href="{u shopinfo/show id=$item['id']}">{$item['name']}</a>
                {if !empty($item['telphone'])}<br/>联系电话：<span style="font-weight:bold;">{$item['telphone']}{if !empty($item['telphone2'])}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$item['telphone2']}{/if}</span>{/if}
                {if !empty($item['mobile'])}<br/>手机号码：<span style="font-weight:bold;">{$item['mobile']}{if !empty($item['mobile2'])}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$item['mobile2']}{/if}</span>{/if}
                <br/>地区：<a href="/shopinfo.php?action=index&cate={$cate_id}&order=default&cityid={$item['city']}&areaname={$item['city_show']}">{$item['province_show']}{$item['city_show']}</a>
                {if $anli_list[$item['uid']]}
                {if $anli_list[$item['uid']]['price2'] > 0}
                <div class="j_price">
                    <label>促销价</label><b class="b1">￥{$anli_list[$item['uid']]['price2']}</b>
                </div>
                {/if}
                <div class="j_price">
                    <label>价格</label><b class="{if $anli_list[$item['uid']]['price2'] > 0}b2{else}b1{/if}">￥{$anli_list[$item['uid']]['price']}</b>
                </div>
                {/if}
            </div>
        </div>
        <!--{/loop}-->
        {else}
        <div class="no_found">
            <div class="i_center"><img src="/public/v1/img/no_found.gif"><p>未找到相关信息</p></div>
        </div>
        {/if}
    </div>

    <div id="pbLoading" style="background:url(./tpl/images/loading.gif) no-repeat center center;height:52px; display:none;"></div>
</div>

<script>
function showtags(tagid,cobj) {
    $('#tags').children().each(function(index, obj){
        $(obj).attr('name') == 'tag_'+tagid || tagid == 0 ? $(obj).show() : $(obj).hide();
    });
    $('.i_tags a').removeClass('current');
    $(cobj).addClass('current');
}

{if !empty($shop_list)}
$('#wfContainer').masonry({
    itemSelector: '.item',
    gutterWidth: 12
});
$(function(){


    $(window).resize(function() {
        resize_masonry();
    });

    resize_masonry();
    
    <!--{if $pager['page_count'] > 0}-->
	createPBScroll("{$pb_url}",appendShareItem,pbLoadingFun,2,{$_FANWE['setting']['share_pb_load_count']},300);
	<!--{/if}-->
});

function resize_masonry(){
    var max_width=$('#wfContainer').width();
    var col_num=max_width>1440?7:5;
    var min_gutter=12;
    var item_width=Math.floor((max_width-min_gutter*(col_num-1))/col_num)-2;
    $('#wfContainer .item').css('width',item_width);
    $('#wfContainer .item .wf_img').each(function(){
        var b=parseInt($(this).attr('width'))/parseInt($(this).attr('height'));
        var item_height=Math.floor(item_width/b);
        $(this).attr('width',item_width);
        $(this).attr('height',item_height);
    });
    $('#wfContainer').masonry( 'reload' );
}

function appendShareItem(result,index) {
	html = '<div>' + result + '</div>';
    html = $(html).find('.item');
	$('#wfContainer').append(html);
    resize_masonry();
}

function pbLoadingFun(bln)
{
	if(bln)
		$("#pbLoading").show();
	else
		$("#pbLoading").hide();
}

function gotourl() {
    var url = '/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&ids=';
    var b = true;
    $('input[name="ids"]').each(function(index, obj) {
        if(obj.checked == true) {
            url += (b ? '' : ',') + obj.value;
            b = false;
        }
    });
    location.href = url;
}
{/if}

$("#areatigger").click(function(){
    $('#area').show();
});

function checkHover(e,handler){
    if(e.type != 'mouseout' && e.type != 'mouseover') return false;
    var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;
    while(reltg && reltg != handler)
        reltg = reltg.parentNode;

    return (reltg && reltg != handler);
}

jQuery(function($){
	$.Bind_City("#province","#city","{$_FANWE['user']['reside_province']}","{$_FANWE['user']['reside_city']}");
});

var cityids = [{if !empty($cityidarr)}<?php echo implode(',',$cityidarr); ?>{/if}], citynames = [{if !empty($cityidarr) && !empty($areanamearr)}'<?php echo implode('\',\'',$areanamearr); ?>'{/if}];
function addcity() {
    var cityid = $('#city').val();
    for(var i = 0; i < cityids.length; i++) {
        if(cityid == cityids[i]) {
            return;
        }
    }
    var name = $('#city').find("option:selected").text();
    cityids.push(cityid);
    citynames.push(name);
    $('#cities').append('<a id="city_'+cityid+'" href="javascript:rmcity('+cityid+');">'+name+'<span>×</span></a>');
}

function rmcity(cityid) {
    for(var i = 0; i < cityids.length; i++) {
        if(cityid == cityids[i]) {
            break;
        }
    }
    cityids.splice(i, 1);
    citynames.splice(i, 1);
    $('#city_'+cityid).remove();
}

function docitysea() {
    $('#area').hide();
    var url = '/shopinfo.php?action=index&cate={$cate_id}&order={$orderkey}{if isset($_GET['vshop'])}&vshop{/if}&cityid=';
    url += cityids.join(',');
    url += '&areaname=' + citynames.join(',');
    location.href = url;
}

function closearea() {
    $('#area').hide();
}
</script>
<!--{template inc/footer}-->